--[[
	Galactica
	File: afk_timer.lua
]]

Galactica.AfkTimer = {}

function Galactica.AfkTimer.PlayerInitialSpawn(ply)
	Galactica.AfkTimer[ply:SteamID()] = false
	timer.Create("Galactica.AfkTimer "..ply:SteamID(), Galactica_AfkTimer, 1, Galactica.AfkTimer.SetAFK, ply)
end
hook.Add("PlayerInitialSpawn", "Galactica.AfkTimer.PlayerInitialSpawn", Galactica.AfkTimer.PlayerInitialSpawn)

function Galactica.AfkTimer.SetAFK(ply)
	Galactica.AfkTimer[ply:SteamID()] = true
	Error("AFK")
	Galactica.ChatPrint(ply, "You are now afk")
end

function Galactica.AfkTimer.GetAFK(ply)
	return Galactica.AfkTimer[ply:SteamID()]
end

function Galactica.AfkTimer.KeyPress(ply, key)
	if(Galactica.AfkTimer[ply:SteamID()] == true) then
		Galactica.ChatPrint(ply, "You are no longer afk")
		Galactica.AfkTimer[ply:SteamID()] = false
	end
	
	timer.Create("Galactica.AfkTimer "..ply:SteamID(), Galactica_AfkTimer, 1, Galactica.AfkTimer.SetAFK, ply)
end
hook.Add("KeyPress", "Galactica.AfkTimer.KeyPress", Galactica.AfkTimer.KeyPress)
